<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>$http服务获取后台数据</title>
		<script src="../org/angular.min.js"></script>
		<script src="../org/jquery.min.js" ></script>
	</head>
	<body>
		<div ng-app="hd" ng-controller="ctrl">
			
		</div>
		<script>
			var m = angular.module('hd',[]);
			
			m.controller('ctrl',['$scope','$http',function($scope,$http){
//				$http({
//					method:'post',
//					url:'$httpPhp.php',
//                  data:{id:1,name:'renren'}
//				}).then(function(response){
//					console.log(response.data); //成功时执行
//				});


                $http({
					method:'post',
					url:'httpPost.php',
                    data: $.param({id:1,name:'renren'}),     //同时数据需要序列化
                    headers:{'Content-type':'application/x-www-form-urlencoded'}  //angularJs中进行修改，不用在php中改变
				}).then(function(response){
					console.log(response.data); //成功时执行
				});
			}]);
		</script>
	</body>
</html>

